home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h> // exec
- #include <exec/libraries.h>
- #include <exec/memory.h>
- #include <dos/dos.h> // dos
- #include <libraries/mui.h> // libraries
- #include <clib/muimaster_protos.h> // clib
- #include <clib/alib_protos.h>
- #include <proto/exec.h> // proto
- #include <proto/dos.h>
- #include <proto/muimaster.h>
-
- #include <string.h>
- #include <stdio.h>
-
- #include <MUI/SpeedBar_mcc.h>
- #include "mybrush.hpp"
- #include "applic.hpp"
-
- struct Library *MUIMasterBase;
- struct Library *IntuitionBase;
-
- Object *applic::MakeLabel1( STRPTR str )
- {
- return( MUI_MakeObject( MUIO_Label, str, MUIO_Label_SingleFrame ));
- }
-
- Object *applic::MakeCheck( STRPTR str )
- {
- Object *obj = MUI_MakeObject( MUIO_Checkmark, str );
-
- if( obj ) SetAttrs( obj, MUIA_CycleChain, TRUE, TAG_DONE );
-
- return( obj );
- }
-
- Object *applic::MakeCycle( STRPTR *array, STRPTR txt )
- {
- Object *obj = MUI_MakeObject( MUIO_Cycle, txt, array );
-
- if( obj ) SetAttrs( obj, MUIA_CycleChain, TRUE, TAG_DONE );
-
- return( obj );
- }
-
-
- struct MUIS_SpeedBar_Button buttons[] = {
- { 0, "Toggle", "Toggle mode example", MUIV_SpeedBar_ButtonFlag_Toggle, NULL },
- { 1, "Immediate", "Immediate mode example", MUIV_SpeedBar_ButtonFlag_Immediate, NULL },
- { MUIV_SpeedBar_Spacer },
- { 2, "Quit", "This will quit the program", 0, NULL },
- { 2, "Disabled", "This does nothing at all", MUIV_SpeedBar_ButtonFlag_Disabled, NULL },
- { MUIV_SpeedBar_End }
- };
-
-
- applic::applic(void)
- {
- IntuitionBase = (struct Library *) OpenLibrary ( (UBYTE *) "intuition.library", 38);
- if(!( MUIMasterBase = (struct Library *) OpenLibrary( (UBYTE *) "muimaster.library", 19 ))) exit( 20 );
-
- STRPTR Files[] = { "Pic1.iff", "Pic2.iff", "Pic3.iff", "Spacer.iff" };
- for( int i = 0; i < 4; i++ ) Brushes[ i ] = LoadBrush( Files[ i ]);
-
- Modes[0] = "Text + Graphics";
- Modes[1] = "Graphics only";
- Modes[2] = "Text only";
- Modes[3] = NULL;
-
- AppObj = ApplicationObject,
- MUIA_Application_Title, "SpeedBar Test++",
- MUIA_Application_Version, "$VER: SpeedBarTest++ 1.0 (22.09.1999)",
- MUIA_Application_Copyright, "Copyright ©1999 by Diego de Felice",
- MUIA_Application_Author, "Diego de Felice <d.defelice@ba.nettuno.it>",
- MUIA_Application_Description, "Speed(Bar|Button).mcc test program in C++",
- MUIA_Application_Base, "SPEEDBARTESTPP",
-
- SubWindow, MainWin = WindowObject,
- MUIA_Window_ID, MAKE_ID( 'M', 'A', 'I', 'N' ),
- MUIA_Window_Title, "SpeedBarTest++ - ©1999 Diego de Felice",
-
- WindowContents, VGroup,
-
- Child, HGroup,
-
- Child, SpeedBar = SpeedBarObject,
- MUIA_Group_Horiz, TRUE,
- MUIA_SpeedBar_Images, Brushes,
- MUIA_SpeedBar_Borderless, FALSE,
- MUIA_SpeedBar_ViewMode, MUIV_SpeedBar_ViewMode_TextGfx,
- MUIA_SpeedBar_RaisingFrame, FALSE,
- MUIA_SpeedBar_Buttons, buttons,
- MUIA_SpeedBar_SpacerIndex, 3, // -1,
- MUIA_SpeedBar_Spread, FALSE, //TRUE,
- End,
-
- Child, HSpace( 0 ),
- End,
-
- Child, ColGroup( 2 ),
-
- Child, MakeLabel1( "_Borderless" ),
- Child, HGroup,
- Child, borderless = MakeCheck( "_Borderless" ),
- Child, HSpace( 0 ),
- End,
-
- Child, MakeLabel1( "_Raising frames" ),
- Child, HGroup,
- Child, raising = MakeCheck( "_Raising frames" ),
- Child, HSpace( 0 ),
- End,
-
- Child, MakeLabel1( "_View Mode" ),
- Child, HGroup,
- Child, viewmode = MakeCycle( Modes, "_View Mode" ),
- Child, HSpace( 0 ),
- End,
-
- Child, MakeLabel1( "Small _images" ),
- Child, HGroup,
- Child, small = MakeCheck( "Small _images" ),
- Child, HSpace( 0 ),
- End,
-
- Child, MakeLabel1( "_Sunny" ),
- Child, HGroup,
- Child, sunny = MakeCheck( "_Sunny" ),
- Child, HSpace( 0 ),
- End,
- End,
- End,
- End,
- End;
-
- if(AppObj)
- {
- DoMethod( MainWin, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, MUIV_Notify_Application, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit );
-
- DoMethod( buttons[ 0 ].Object, MUIM_Notify, MUIA_Selected, FALSE, SpeedBar, 5, MUIM_SpeedBar_DoOnButton, 1, MUIM_Set, MUIA_Selected, FALSE );
- DoMethod( buttons[ 3 ].Object, MUIM_Notify, MUIA_Pressed, FALSE, AppObj, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit );
-
- DoMethod( borderless, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, SpeedBar, 3, MUIM_Set, MUIA_SpeedBar_Borderless, MUIV_TriggerValue );
- DoMethod( raising, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, SpeedBar, 3, MUIM_Set, MUIA_SpeedBar_RaisingFrame, MUIV_TriggerValue );
- DoMethod( viewmode, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, SpeedBar, 3, MUIM_Set, MUIA_SpeedBar_ViewMode, MUIV_TriggerValue );
- DoMethod( small, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, SpeedBar, 3, MUIM_Set, MUIA_SpeedBar_SmallImages, MUIV_TriggerValue );
- DoMethod( sunny, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, SpeedBar, 3, MUIM_Set, MUIA_SpeedBar_Sunny, MUIV_TriggerValue );
-
- SetAttrs( MainWin, MUIA_Window_Open, TRUE, TAG_DONE );
- }
- }
-
- applic::~applic(void)
- {
- MUI_DisposeObject( AppObj );
- for( int i = 0; i < 4; i++ ) FreeBrush( Brushes[ i ]);
- CloseLibrary( MUIMasterBase );
- CloseLibrary( IntuitionBase);
- }
-
- void applic::inlooppati(void)
- {
- ULONG sigs = 0;
-
- while( DoMethod( AppObj, MUIM_Application_NewInput, &sigs ) != MUIV_Application_ReturnID_Quit )
- {
- if( sigs )
- {
- sigs = Wait( sigs | SIGBREAKF_CTRL_C );
- if( sigs & SIGBREAKF_CTRL_C ) break;
- }
- }
- }
-
-